package com.jinbo.sxzq;

import android.util.Log;

/***********棋子猴********************/
public class Chess_Hou extends Chess{
    Chess_Hou(int type,int index, int[] location, int owner, GameControl gameControl) {
        /********初始化信息****************/
        super(index, location, owner, gameControl);
        this.type = type;
        this.name = ProjectConstants.ChessName.HOU;
        this.message = ProjectConstants.ChessMasage.HOU;
        this.type = ProjectConstants.ChessType.HOU;
        this.hp = 2;
        this.maxHp = 2;
        this.mp = 0;
        this.maxMp = 2;
        this.mobility = 2;
        this.maxmobility = 2;
        this.atk = 1;
    }

    public void Action(){
        super.Action();
    }

    public void Move(Chess chess){
        super.Move(chess);
    }

    public void Attack(Chess chess){
        super.Attack(chess);
    }

    public void RoundNext(){
        super.RoundNext();
    }

    //重写技能猴：【借势】周围友方棋子多时生命+1，周围敌方棋子多时行动力+1。
    public void Skill(){
        super.Skill();
        int chess_num_o = 0;
        int chess_num_e = 0;
        for(int i = 0 ; i < gameControl.chess_list.size() ; i++){
                Chess chess = gameControl.chess_list.get(i);
                float length = Math.max(chess.location[0]-location[0],chess.location[1]-location[1]);
                if(length == 1){
                    if(chess.owner == owner){
                        chess_num_o++;
                    }else{
                        chess_num_e++;
                    }
                }
        }
        Log.e("Skill——猴" , "触发技能");
        if(chess_num_e > chess_num_o){
            atk++;
        }else{
            hp++;
        }
    }

    public void Kill(Chess chess){
        super.Kill(chess);
    }
}
